<?php
class LoginController extends Controller
{
	public function beforeAction()
	{

	}

	public function actionIndex()
	{
		include "tpl/login.html";
	}

	public function actionLogin()
	{
		$user = isset($_POST["NetsysName"])?$_POST["NetsysName"]:'';
		$pwd = isset($_POST["NetsysPass"])?$_POST["NetsysPass"]:'';

		$user = DB::table("Manage")->where('NetsysName =:user',array(":user"=>$user))->find();
		$user = array_pop($user);
		if(!empty($user)){
			if($user['NetsysPass'] == md5($pwd)){
				  $_SESSION["NetsysName"]=$user['NetsysName']; 
				  $_SESSION["NetsysPass"]="lingmov.com"; 
				  $_SESSION["NetsyClass"]=$user['NetsyClass']; 
			}
		}
		Response::redirect(Url::create('/xphp/index.php?cate=000'));
	}
}